<div class="tab_item" style="display:block;">
    <div class="ui_table">
        <form method="post">
            <fieldset>
                <legend>基本信息</legend>
                <div class="ui_table">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <td align="right">代理商名称：</td>
                            <td><input type="text" maxlength="20" class="text easyui-validatebox" name="agencyName" value="${(entity.agencyName)!''}"/></td>
                            <td align="right">联系电话：</td>
                            <td><input type="text" class="text easyui-validatebox" name="tel" maxlength="17" value="${(entity.tel)!''}"/></td>
                        </tr>
                        <#--新增：-->
                        <tr>
                            <td align="right" width="80">负责人姓名：</td>
                            <td><input type="text" maxlength="20" class="text easyui-validatebox" name="principalName" value="${(entity.principalName)!''}"/></td>
                            <td align="right">详细地址：</td>
                            <td><input type="text" class="text easyui-validatebox" name="detailAddress" maxlength="17" value="${(entity.detailAddress)!''}"/></td>
                        </tr>
                        <tr>
                            <td align="right">备注：</td>
                            <td colspan="3">
                                <textarea style="width:420px;" name="memo">${(entity.memo)!''}</textarea>
                            </td>
                        </tr>
                    </table>
                </div>
            </fieldset>
        </form>
    </div>
</div>
<script>
    (function() {
        var pid = '${pid}',
                win = $('#${pid}'),
                jform = win.find('form'),
                form = jform[0];

        var snapshot = $.toJSON({
            id: '${entity.id}',
            agencyName: '${(entity.agencyName)!''}',
            tel: '${(entity.tel)!''}',
            memo: '${(entity.memo)!''}',
            activeFlag: <#if (entity.activeFlag)?? && entity.activeFlag == 1>1<#else>0</#if>,
            // 新增
            principalName:'${(entity.principalName)!''}',
            detailAddress:'${(entity.detailAddress)!''}'
        });

        var ok = function() {
            if(!jform.form('validate')) {
                return false;
            }
            var success = true;
            var values = {
                id: '${entity.id}',
                agencyName: form.agencyName.value,
                tel: form.tel.value,
                memo: form.memo.value,
                activeFlag: $('#active_flag_1').attr('checked') ? 1 : 0,
                //新增
                principalName: form.principalName.value,
                detailAddress: form.detailAddress.value
            };

            if(snapshot != $.toJSON(values)) {
                $.ajax({
                    cache: false,
                    async: false,
                    type: 'POST',
                    url: '${contextPath}/security/hdw/agency/update_basic_info.htm',
                    dataType: 'json',
                    data: values,
                    success: function (json) {
                    <@app.json_jump/>
                        if (json.success) {
                        } else {
                            $.messager.alert('提示信息', json.message, 'info');
                            success = false;
                        }
                    }
                });
            }

            return success;
        }

        win.data('ok', ok);

    })();
</script>


